import { canUseDom } from '@/library/tool-kits/can-use-dom'
import { info } from '@/library/tool-kits/log'

// eslint-disable-next-line import/no-mutable-exports
export let supportsPassive = false

if (canUseDom) {
  try {
    const opts = {}
    Object.defineProperty(opts, 'passive', {
      get() {
        info(
          'Global.passive',
          'The Webview Supports Options `passive`',
        )
        supportsPassive = true
      },
    })
    window.addEventListener('test-passive', null as any, opts)
    window.removeEventListener('test-passive', null as any, opts)
  } catch (e) {
    // no-use
  }
}
